<?php
/*
 * @Date: 2021-05-08 11:11:57
 * @Author: yukun
 * @LastEditors: yukun
 * @LastEditTime: 2021-05-08 12:44:06
 * @FilePath: /design-patterns-study/观察者模式/SecrityObserver.php
 * @Description: 安全模块观察者
 */

class SecrityObserver implements SplObserver
{
    public function update(SplSubject $subject)
    {
        if ($subject->loginNum < 3) {
            echo "这是第" . $subject->loginNum . "次登陆" . PHP_EOL;
        } else {
            echo "当前登录次数：" . $subject->loginNum . "。不可频繁登陆" . PHP_EOL;
        }
    }
}
